#ifndef INPUTUSERS_H
#define INPUTUSERS_H

#include <QDialog>
#include <QThread>

namespace Ui {
class InputUsers;
}

class InputUsersThread : public QThread
{
    Q_OBJECT

    typedef std::vector< std::vector<std::string> >    UserData;
public:
    void    setFilePath(QString path);
    void    setGID(int gid);
    bool    getUsers(UserData& data);
    void    sendToServer(UserData& data);

signals:
    void    onPrograss(int);
    void    onInfo(QString);
    void    onEnd();

public:
    void run();

private:
    QString        m_filepath;
    int            m_gid;
};

class InputUsers : public QDialog
{
    Q_OBJECT
    
public:
    explicit InputUsers(int gid, QString group, QWidget *parent = 0);
    ~InputUsers();
    
public slots:
    void onFindFile();
    void onBeginInput();
    void onCancel();
    void onInfo(QString info);

private:
    Ui::InputUsers      *ui;
    int                 m_gid;
    bool                m_isinputing;
    InputUsersThread    m_thread;
};

#endif // INPUTUSERS_H
